/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.uefs.cedoc.controle.fundo;

import br.uefs.cedoc.db.fundo.DBFundo;

/**
 *
 * @author suporte
 */


import br.uefs.cedoc.controle.*;
import br.uefs.cedoc.db.exception.DBConnectionException;
import javax.servlet.*;
import javax.servlet.http.*;
import br.uefs.cedoc.db.*;
import br.uefs.cedoc.db.fundo.DBFundo;
import br.uefs.cedoc.entidades.*;
import java.sql.SQLException;
  
public class GetFundoCommand implements Command {
  private String next;

  public GetFundoCommand(String next) {
    this.next = next;
  }

    public String execute(HttpServletRequest req)
    throws CommandException {
        try {
            
            DBFundo dbfundo = new DBFundo();
            FundoBean fundo = new FundoBean();            
            //fundo.setIdfundo();
            int id = Integer.parseInt(req.getParameter("id"));
            fundo = dbfundo.listaFundo(id);
            //System.out.println("deletada = "+ fundo.getIdfundo()+ "N= "+fundo.getFundo());
            req.setAttribute("fundo",fundo);

            } catch (SQLException ex) {
                ex.printStackTrace();
            } catch (DBConnectionException ex) {
                ex.printStackTrace();
            }

            req.setAttribute("status.msg", "tetes");
            
            return next;

    }
}


